﻿<phone:PhoneApplicationPage 
    x:Class="LinkED_WP.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait" 
    shell:SystemTray.IsVisible="True" d:DesignHeight="696" d:DesignWidth="480">

    <Grid Background = "{StaticResource PhoneBackgroundBrush}" >
        <Grid.RowDefinitions>
            <RowDefinition Height ="0.2*"/>
            <RowDefinition Height ="0.8*"/>
        </Grid.RowDefinitions>

        <TextBlock HorizontalAlignment="Stretch" Margin="10" 
                   Name="LABLE_TITLE" Text="LinkED" FontSize="80"
                   VerticalAlignment="Stretch" Grid.ColumnSpan="2"
                   TextAlignment="Left" IsHitTestVisible="True" FontFamily="Segoe WP Semibold" />

        <ListBox x:Name="AllPCItems" Margin="10" Grid.Row="1" SelectionChanged="AllPCItems_SelectionChanged">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border BorderBrush ="{StaticResource PhoneAccentBrush}"
                            BorderThickness = "5" CornerRadius ="10" Margin= "2" 
                            HorizontalAlignment ="Stretch" VerticalAlignment = "Stretch"
                            Width ="Auto" Height = "150" MinWidth="450" Tag="{Binding PCID}" >
                        
                        <StackPanel Orientation="Horizontal" Margin="5" >

                            <Image x:Name="ImgPC" Source="Images/PC.png" 
                                   Width ="150" Height="150" />

                            <StackPanel Orientation="Vertical">

                                <toolkit:ContextMenuService.ContextMenu>
                                    <toolkit:ContextMenu Width="200" BorderBrush="{StaticResource PhoneAccentBrush}"
                                                         BorderThickness="5" >
                                        <toolkit:MenuItem Header="删除" FontSize="40" FontFamily="Segoe WP Semibold" 
                                                          VerticalAlignment ="Center" HorizontalAlignment="Right"
                                                          BorderBrush ="{StaticResource PhoneAccentBrush}" 
                                                          BorderThickness = "10"
                                                          Tag ="{Binding PCID}" Click="ContextMenuItem_Click"/>
                                    </toolkit:ContextMenu>
                                </toolkit:ContextMenuService.ContextMenu>

                                <TextBlock x:Name="txtBLKIP"  Text="{Binding IPAddress}" FontFamily="Segoe WP Semibold" 
                                        FontSize="40" TextAlignment="Left" HorizontalAlignment="Stretch"
                                        VerticalAlignment="Stretch" Height="Auto" Width="Auto" Margin="0" MinWidth="300"/>

                                <TextBlock x:Name="txtBLKName" Text="{Binding PCName}" FontFamily="Segoe WP Semibold" 
                                        FontSize="40" TextAlignment="Left" HorizontalAlignment="Stretch"
                                        VerticalAlignment="Stretch" Height="Auto" Width="Auto" Margin="0"  MinWidth="300"/>
                                
                            </StackPanel>
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
    
    <!--演示 ApplicationBar 用法的示例代码-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri= "Images/appbar.add.rest.png" 
                                            Text="添加"  Click="ApplicationBarIconButton_Click" />

            <shell:ApplicationBarIconButton IconUri ="Images/appbar.feature.settings.rest.png" 
                                            Text ="设置" Click="ApplicationBarIconButton_Feature_Setting" />

            <shell:ApplicationBarIconButton IconUri ="Images/appbar.questionmark.rest.png" 
                                            Text ="关于" Click="ApplicationBarIconButton_Question_Click" />

            <shell:ApplicationBar.MenuItems >
                <shell:ApplicationBarMenuItem Text="全部删除" Click="ApplicationBarMenuItem_DeleteAll_Click"/>
            </shell:ApplicationBar.MenuItems>
            
        </shell:ApplicationBar>
       
    </phone:PhoneApplicationPage.ApplicationBar>
    


</phone:PhoneApplicationPage>